#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
class Tmytime{
      private:
              int h,m,s;
      public :
             void EnterTime(){
                              do{
                                 cout<<"Enter HH : ";
                                 cin>>h;
                                 } while (h<0 || h>23);
                              do{
                              cout<<"Enter MM : ";
                              cin>>m;
                              } while (m<0 || m>59);
                              do{
                              cout<<"Enter SS : ";
                              cin>>s;
                              } while (s<0 || s>59);
                  }
             void PrintTime(){
                              cout<<" The time is "<<h<<" : "<<m<<" : "<<s<<endl;
                  }
             void tpp(){
                        s++;
                        if (s>59){
                                  m++;
                                  s=0;
                                  }
                        if (m>59){
                                  m=0;
                                  s=0;
                                  h++;
                                  
                                  }
                        if (h>23){
                                   h=0;
                                   m=0;
                                   s=0;
                                  }
                  }
             
};

int main(){
    do{
    Tmytime t;
    t.EnterTime();
    t.PrintTime();
    t.tpp();
    t.PrintTime();
} while (getch()!=27);
    system("pause"); 
    return 0;    
}